home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / nitedrvr.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  8KB  |  226 lines

  1. /***************************************************************************
  2.  
  3. Atari Night Driver Driver :)
  4.  
  5. Memory Map:
  6.         0000-01FF    R/W     SCRAM (Scratchpad RAM)
  7.         0200-03FF     W        PFW (Playfield Write)
  8.         0400-05FF     W        HVC (Horiz/Vert/Char for Roadway)
  9.         0600-07FF     R        IN0
  10.         0800-09FF     R        IN1
  11.         0A00-0BFF     W        OUT0
  12.         0C00-0DFF     W        OUT1
  13.         0E00-0FFF     -        OUT2 (Not used)
  14.         8000-83FF     R        PFR (Playfield Read)
  15.         8400-87FF            Steering Reset
  16.         8800-8FFF     -        Spare (Not used)
  17.         9000-97FF     R        Program ROM1
  18.         9800-9FFF     R        Program ROM2
  19.        (F800-FFFF)     R        Program ROM2 - only needed for the 6502 vectors
  20.  
  21. If you have any questions about how this driver works, don't hesitate to
  22. ask.  - Mike Balfour (mab22@po.cwru.edu)
  23. ***************************************************************************/
  24.  
  25. #include "driver.h"
  26. #include "vidhrdw/generic.h"
  27.  
  28. /* machine/nitedrvr.c */
  29. extern unsigned char *nitedrvr_ram;
  30. READ_HANDLER( nitedrvr_in0_r );
  31. READ_HANDLER( nitedrvr_in1_r );
  32. READ_HANDLER( nitedrvr_ram_r );
  33. READ_HANDLER( nitedrvr_steering_reset_r );
  34. WRITE_HANDLER( nitedrvr_steering_reset_w );
  35. WRITE_HANDLER( nitedrvr_out0_w );
  36. WRITE_HANDLER( nitedrvr_out1_w );
  37. WRITE_HANDLER( nitedrvr_ram_w );
  38.  
  39.  
  40. /* vidhrdw/nitedrvr.c */
  41. extern unsigned char *nitedrvr_hvc;
  42. WRITE_HANDLER( nitedrvr_hvc_w );
  43. extern void nitedrvr_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  44.  
  45.  
  46. static struct MemoryReadAddress readmem[] =
  47. {
  48.     { 0x0000, 0x00ff, nitedrvr_ram_r }, /* SCRAM */
  49.     { 0x0100, 0x01ff, nitedrvr_ram_r }, /* SCRAM */
  50.     { 0x0600, 0x07ff, nitedrvr_in0_r },
  51.     { 0x0800, 0x09ff, nitedrvr_in1_r },
  52.     { 0x8000, 0x807f, videoram_r }, /* PFR */
  53.     { 0x8080, 0x80ff, videoram_r }, /* PFR */
  54.     { 0x8100, 0x817f, videoram_r }, /* PFR */
  55.     { 0x8180, 0x81ff, videoram_r }, /* PFR */
  56.     { 0x8200, 0x827f, videoram_r }, /* PFR */
  57.     { 0x8280, 0x82ff, videoram_r }, /* PFR */
  58.     { 0x8300, 0x837f, videoram_r }, /* PFR */
  59.     { 0x8380, 0x83ff, videoram_r }, /* PFR */
  60.     { 0x8400, 0x87ff, nitedrvr_steering_reset_r },
  61.     { 0x9000, 0x9fff, MRA_ROM }, /* ROM1-ROM2 */
  62.     { 0xfff0, 0xffff, MRA_ROM }, /* ROM2 for 6502 vectors */
  63.     { -1 }    /* end of table */
  64. };
  65.  
  66. static struct MemoryWriteAddress writemem[] =
  67. {
  68.     { 0x0000, 0x00ff, nitedrvr_ram_w, &nitedrvr_ram }, /* SCRAM */
  69.     { 0x0100, 0x01ff, nitedrvr_ram_w }, /* SCRAM */
  70.     { 0x0200, 0x027f, videoram_w, &videoram, &videoram_size }, /* PFW */
  71.     { 0x0280, 0x02ff, videoram_w }, /* PFW */
  72.     { 0x0300, 0x037f, videoram_w }, /* PFW */
  73.     { 0x0380, 0x03ff, videoram_w }, /* PFW */
  74.     { 0x0400, 0x05ff, nitedrvr_hvc_w, &nitedrvr_hvc }, /* POSH, POSV, CHAR, Watchdog */
  75.     { 0x0a00, 0x0bff, nitedrvr_out0_w },
  76.     { 0x0c00, 0x0dff, nitedrvr_out1_w },
  77.     { 0x8400, 0x87ff, nitedrvr_steering_reset_w },
  78.     { 0x9000, 0x9fff, MWA_ROM }, /* ROM1-ROM2 */
  79.     { -1 }    /* end of table */
  80. };
  81.  
  82. INPUT_PORTS_START( nitedrvr )
  83.     PORT_START        /* fake port, gets mapped to Night Driver ports */
  84.         PORT_DIPNAME( 0x30, 0x10, "Cost" )
  85.         PORT_DIPSETTING(    0x00, "2 plays/coin" )
  86.         PORT_DIPSETTING(    0x10, "1 play/coin" )
  87.         PORT_DIPSETTING(    0x20, "1 play/coin" ) /* not a typo */
  88.         PORT_DIPSETTING(    0x30, "1 play/2 coins" )
  89.         PORT_DIPNAME( 0xC0, 0x80, "Seconds" )
  90.         PORT_DIPSETTING(    0x00, "50" )
  91.         PORT_DIPSETTING(    0x40, "75" )
  92.         PORT_DIPSETTING(    0x80, "100" )
  93.         PORT_DIPSETTING(    0xC0, "125" )
  94.  
  95.     PORT_START        /* fake port, gets mapped to Night Driver ports */
  96.         PORT_DIPNAME( 0x10, 0x00, "Track Set" )
  97.         PORT_DIPSETTING(    0x00, "Normal" )
  98.         PORT_DIPSETTING(    0x10, "Reverse" )
  99.         PORT_DIPNAME( 0x20, 0x20, "Bonus Time Allowed" )
  100.         PORT_DIPSETTING(    0x00, "None" )
  101.         PORT_DIPSETTING(    0x20, "Score=350" )
  102.         PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_VBLANK )
  103.         PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_SERVICE | IPF_TOGGLE, "Self Test", KEYCODE_F2, IP_JOY_NONE )
  104.  
  105.     PORT_START        /* fake port, gets mapped to Night Driver ports */
  106.         PORT_BITX(0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_PLAYER2, "1st gear", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  107.         PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_PLAYER2, "2nd gear", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  108.         PORT_BITX(0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_PLAYER2, "3rd gear", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  109.         PORT_BITX(0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_PLAYER2, "4th gear", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  110.  
  111.     PORT_START        /* fake port, gets mapped to Night Driver ports */
  112.         PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* Spare */
  113.         PORT_DIPNAME( 0x20, 0x00, "Difficult Bonus" )
  114.         PORT_DIPSETTING(    0x00, "Normal" )
  115.         PORT_DIPSETTING(    0x20, "Difficult" )
  116.         PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  117.         PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  118.  
  119.     PORT_START        /* fake port, gets mapped to Night Driver ports */
  120.         PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  121.         PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  122.         PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_START1 )
  123.         PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON1, "Gas", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  124.         PORT_BITX(0x10, IP_ACTIVE_HIGH, IPT_BUTTON2, "Novice Track", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  125.         PORT_BITX(0x20, IP_ACTIVE_HIGH, IPT_BUTTON3, "Expert Track", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  126.         PORT_BITX(0x40, IP_ACTIVE_HIGH, IPT_BUTTON4, "Pro Track", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  127.         PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* Alternating signal? */
  128.  
  129.     PORT_START        /* fake port used for steering */
  130.         PORT_ANALOG( 0xff, 0x00, IPT_DIAL, 100, 10, 0, 0 )
  131.  
  132. INPUT_PORTS_END
  133.  
  134.  
  135. static struct GfxLayout charlayout =
  136. {
  137.     8,8,    /* 8*8 characters */
  138.     64,     /* 64 characters */
  139.     1,        /* 1 bit per pixel */
  140.     { 0 },          /* no separation in 1 bpp */
  141.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  142.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  143.     8*8 /* every char takes 8 consecutive bytes */
  144. };
  145.  
  146. static struct GfxDecodeInfo gfxdecodeinfo[] =
  147. {
  148.     { REGION_GFX1, 0, &charlayout, 0x00, 0x02 }, /* offset into colors, # of colors */
  149.     { -1 } /* end of array */
  150. };
  151.  
  152. static unsigned char palette[] =
  153. {
  154.     0x00,0x00,0x00, /* BLACK */
  155.     0xff,0xff,0xff, /* WHITE */
  156.     0x55,0x55,0x55, /* DK GREY - for MAME text only */
  157.     0x80,0x80,0x80, /* LT GREY - for MAME text only */
  158. };
  159. static unsigned short colortable[] =
  160. {
  161.     0x00, 0x01,
  162.     0x01, 0x00,
  163. };
  164. static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
  165. {
  166.     memcpy(game_palette,palette,sizeof(palette));
  167.     memcpy(game_colortable,colortable,sizeof(colortable));
  168. }
  169.  
  170.  
  171. static struct MachineDriver machine_driver_nitedrv =
  172. {
  173.     /* basic machine hardware */
  174.     {
  175.         {
  176.             CPU_M6502,
  177.             1000000,       /* 1 MHz ???? */
  178.             readmem,writemem,0,0,
  179.             interrupt,1
  180.         }
  181.     },
  182.     57, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  183.     1,    /* single CPU, no need for interleaving */
  184.     0,
  185.  
  186.     /* video hardware */
  187.     32*8, 32*8, { 0*8, 32*8-1, 0*8, 32*8-1 },
  188.     gfxdecodeinfo,
  189.     sizeof(palette) / sizeof(palette[0]) / 3, sizeof(colortable) / sizeof(colortable[0]),
  190.     init_palette,
  191.  
  192.     VIDEO_TYPE_RASTER,
  193.     0,
  194.     generic_vh_start,
  195.     generic_vh_stop,
  196.     nitedrvr_vh_screenrefresh,
  197.  
  198.     /* sound hardware */
  199.     0,0,0,0
  200.  
  201. };
  202.  
  203.  
  204.  
  205.  
  206.  
  207. /***************************************************************************
  208.  
  209.   Game ROMs
  210.  
  211. ***************************************************************************/
  212.  
  213. ROM_START( nitedrvr )
  214.     ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
  215.     ROM_LOAD( "6569-01.d2",   0x9000, 0x0800, 0x7afa7542 )
  216.     ROM_LOAD( "6570-01.f2",   0x9800, 0x0800, 0xbf5d77b1 )
  217.     ROM_RELOAD(               0xf800, 0x0800 )
  218.  
  219.     ROM_REGION( 0x0200, REGION_GFX1 | REGIONFLAG_DISPOSE )
  220.     ROM_LOAD( "6568-01.p2",   0x0000, 0x0200, 0xf80d8889 )
  221. ROM_END
  222.  
  223.  
  224.  
  225. GAMEX( 1976, nitedrvr, 0, nitedrv, nitedrvr, 0, ROT0, "Atari", "Night Driver", GAME_NO_SOUND )
  226.